package com.work.i18n;

import java.util.*;

public class Messages {

	private static final String BUNDLE_NAME = "com.work.i18n.messages";

	private static ResourceBundle MESSAGES= ResourceBundle.getBundle(BUNDLE_NAME, new Locale("pl"));

	public static String get(String key) {
		try {
			return MESSAGES.getString(key);
		} catch (MissingResourceException e) {
			return '!' + key + '!';
		}
	}

	public static void setLocale(Locale browserLocale) {
		MESSAGES = ResourceBundle.getBundle(BUNDLE_NAME, browserLocale);
	}
}
